<template>
  <div style="height: 100%">
    <Header title="签约景区" :back="true" />
    <div class="singedSpots">
      <div class="bg"></div>
      <div class="title">
        签约景区<span class="total_count"
          >总计{{ spotsData.length }}个</span
        >
      </div>
      <div class="list_wrap">
        <!-- <div v-for="spot in spots" :key="spot" class="spot" @click="detail(spot)">
                    <div class="city">四川-成都</div>
                    <div class="img_box"><img src="http://test.tch.028wlkj.com:32904/u/file/show/image/1701520364867293184" alt=""></div>
                    <div class="spot_name">西岭雪山-{{spot}}</div>
                    <div class="price_wrap">门票：<span class="price">¥80</span></div>
                </div> -->

        <div
          v-for="(spot, index) in spotsData"
          :key="index"
          class="spot"
          @click="detail(spot.scenicSpotId)"
        >
          <div class="city">{{spot.scenicSpotPlace}}</div>
          <div class="img_box">
            <img
              :src="spot.scenicSpotImg"
              alt=""
            />
          </div>
          <div class="spot_name">{{ spot.scenicSpotName }}</div>
          <div class="price_wrap">
            门票：<span class="price">¥{{ spot.scenicSpotPrice }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref, reactive } from "vue";
import { useRoute, useRouter } from "vue-router";
import api from "@/api/index.js";

import signedscenicspotsbg from "@/assets/images/index/signedscenicspots_bg.png";
const route = useRoute();
const router = useRouter(); //路由跳转

const detail = (id) => {
  console.log(id);
  router.push({ path: `/goldenCard/spot/${id}` });
};

const spotsData = ref([]);
const getSpots = () => {
  api.getSignedSpots().then((res) => {
    spotsData.value = res.data.list
    console.log(spotsData.value);
  });
};
getSpots();
</script>

<style lang="scss" scoped>
.singedSpots {
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 100%;
  //   align-items: center;
  position: relative;
  .bg {
    position: absolute;
    z-index: -1;
    width: 100%;
    height: 500px;
    top: 0;
    background: url("@/assets/images/index/signedscenicspots_bg.png") no-repeat;
    background-position: 0 0;
    background-size: cover;
  }
}
.title {
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0px;
  line-height: 19.21px;
  color: rgba(50, 50, 50, 1);
  padding-left: 38px;
  position: relative;
  padding-right: 26px;
  height: 28px;
  margin-bottom: 12px;
  margin-top: 17px;
  &::before {
    content: "";
    position: absolute;
    height: 28px;
    width: 8px;
    border-radius: 6px;
    left: 20px;
    top: -4px;
    background-color: rgba(79, 172, 145, 1);
  }
  .total_count {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0px;
    line-height: 16.46px;
    color: rgba(139, 139, 139, 1);
    text-align: left;
    vertical-align: top;
    float: right;
  }
}
.list_wrap {
  width: 90%;
  padding-bottom: 20px;
  // vertical-align: middle;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  height: 100%;
  overflow-y: auto;
  position: relative;
  align-content: baseline;
  padding-bottom: 50px;
  // flex-direction: column;
  .spot {
    position: relative;
    display: block;
    height: 170px;
    width: 48%;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(255, 255, 255, 1);
    box-shadow: 2px 2px 6px rgba(189, 189, 189, 0.7);
    .img_box {
      width: 100%;
      height: 126px;
      width: 100%;
      overflow: hidden;
      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }
    .city {
      position: absolute;
      height: 26px;
      line-height: 26px;
      padding: 0 10px;
      border-radius: 0 0 6px 0;
      background: rgba(13, 13, 13, 0.6);
      font-size: 10px;
      font-weight: 400;
      letter-spacing: 0px;
      color: rgba(255, 255, 255, 1);
      text-align: left;
      vertical-align: top;
    }
    .spot_name {
      margin-top: 5px;
      padding-left: 4px;
      margin-bottom: 3px;
      font-size: 12px;
      font-weight: bold;
      letter-spacing: 0px;
      line-height: 16.46px;
      color: rgba(50, 50, 50, 1);
      text-align: left;
      vertical-align: top;
    }
    .price_wrap {
      margin-left: 50%;
      left: 284px;
      font-size: 12px;
      font-weight: 400;
      letter-spacing: 0px;
      line-height: 16px;
      color: rgba(50, 50, 50, 1);
      text-align: left;
      vertical-align: middle;
      height: 22px;
      white-space: nowrap;
      .price {
        left: 317px;
        font-size: 16px;
        font-weight: 500;
        letter-spacing: 0px;
        line-height: 16px;
        color: rgba(239, 119, 35, 1);
        text-align: left;
        vertical-align: top;
      }
    }
  }
}
</style>
